package com.cms.doc.action;

import java.util.ArrayList;
import java.util.List;

import com.cms.doc.model.DocText;
import com.jframe.sys.controller.ExtendAction;
import com.jframe.sys.controller.utils.DicCache;
import com.jframe.sys.controller.utils.JsBuilder;
import com.jframe.sys.utils.JsonUtil;
import com.jframe.sys.webui.Columns;
import com.jframe.sys.webui.Editor;
import com.jframe.sys.webui.Grid;

public class OnlineReviewAction extends ExtendAction {
	private static String ACTION="onlineReviewAction";
	private static String SERVICE = "onlineReviewService";
	private static Class<DocText> CLAZZ = DocText.class;
	
	public void list(){
		List<Columns> frozenColumns = new ArrayList<Columns>();// 固定列
		List<Columns> commonColumns = new ArrayList<Columns>();// 活动列
		
		frozenColumns.add(new Columns("ck", "", 40, ""));
		frozenColumns.add(new Columns("id", "编号", 100, ""));
		frozenColumns.add(new Columns("docTitle", "文档标题", 320, ""));
		commonColumns.add(new Columns("reviewUser", "评论人", 100, ""));
		commonColumns.add(new Columns("ip", "评论客户端IP地址", 120, ""));
		commonColumns.add(new Columns("reviewTime", "评论时间", 120, ""));
		commonColumns.add(new Columns("status", "状态", 120, new Editor("combobox",true),DicCache.getComboboxJson("dm_cms_onlineReviewStatus")));
		if(this.pageInfo.getPageTabId(request).equals("1")){
			commonColumns.add(new Columns("操作", 120, "operation"));
		}
		Grid grid = new Grid();
		grid.setUrl(getUrl(ACTION+".do?method=load"));
		String js = JsBuilder.getJsStr(frozenColumns, commonColumns, grid);
		this.request.setAttribute("js", js);
		this.forward("/cms/doc/list/onlineReviewList.jsp");
	}
	
	public void load(){
		baseLoad(SERVICE, CLAZZ);
	}
	
	public void save() {
		baseSave(SERVICE, CLAZZ);
	}
	
	public void delete() {
		baseDelete(SERVICE);
	}
	
	public void getObjById() {
		print(JsonUtil.obj2Json(this.getObject(SERVICE)));
	}
}
